<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="system.bean.Role"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Object opType   = request.getAttribute("opType"); //获取操作对象
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>NETCONF Development Toolkit</title>
	<meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/index.css" />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/items.css" />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/subItems.css" />
    <script type="text/javascript"  src="<%=basePath%>js/getElementPos.js"></script>
    <script type="text/javascript"  src="<%=basePath%>js/coverLayer.js"></script>
    <script type="text/javascript"  src="<%=basePath%>js/Role.js"></script>
    <script type="text/javascript"  src="<%=basePath%>jstree-v.pre1.0/_lib/jquery.js"></script>
    <script type="text/javascript"  src="<%=basePath%>js/StringUtil.js"></script>
  </head>
  <body>
  <script type="text/javascript">
   function bodyLoad(){
   		<% if(null != request.getAttribute("addMsg")){ %>
   			 $("#opNoticeSpan").html(request.getAttribute("addMsg"));
   		 	 setTimeout(function(){$("#opNoticeSpan").html("")},3000);
   		<% } %>
   }
   $(document).ready(function(){
        $("#submitButton").click(function(){
	 	     $(":input").css("border-color","");
		     if($("#_title").val().trim().length == 0){
		        $("#_title").css("border-color","red");
		        alert("Title 不能为空！");
		        return;
		     }
		     if($("#_identify").val().trim().length == 0){
		     	$("#_identify").css("border-color","red");
		        alert("Identify 不能为空！");
		        return;
		     }
		     //提交角色添加
		     submitAddRole(); 
		});
		 bodyLoad();
 	});
 	
</script>
  <form id="roleForm" method="post" action="<%=basePath %>AddRoleServlet" class="IndexFormStyle" >
   <div id="TableContent" class="tableContent" >
   	   <div class="itemTitle">
	        新增角色  
	   </div>
	   <div class="itemDiv">
	     <span class="textSpan">&nbsp; Title:</span>
	     <input class="inputText" id="_title" name="_title" value="" />
	   </div>
	   <div class="itemDiv">
	     <span class="textSpan">&nbsp; Identify:</span>
	     <input class="inputText" id="_identify" name="_identify" value="" />
	   </div>
	   <div class="itemDiv">
	   		<span class="textSpan">&nbsp;comment:</span><br/>
	    	<textarea class="textArea"  id="_comment" name="_comment"></textarea>
	   </div>
   </div>
   <div id="submitContent" class="submitContent">
     <span id="opNoticeSpan" style="color:red;" ></span>
     <span class="textSpan">&nbsp;</span>
     <input type="button" id="submitButton" value="Apply"  />
   </div>
   </form>
   <div class="itemTitle">
	  角色列表  
   </div>
   <div style=" padding:5px;border:1px solid #EAEAEA; margin:5px; "  >
  		<div id="QAmembersListDiv" style="margin:0px;overflow:auto;max-height:300px;border:1px;border-color:#666;font-size:14px;">
  		  <% ArrayList<Object> list = (ArrayList<Object>)request.getAttribute("List"); %>
  		  <% for(int i = 0 ; i < list.size() ; i++){ %>
  		  <% Role role = (Role)list.get(i); %>
  		   <div style="float:left;width:200px; margin:5px;padding-top:5px; border:1px dotted #CCC;">
  		       <div style="float:left;width:125px;"><%=role.getTitle() %></div>
  		       <div style="float:left;width:25px;cursor:pointer;"><img onclick="AssignOpToRole(<%=role.getRoleId() %>,'<%=role.getTitle() %>')" class="buttonBcImg" width="20" src="<%=basePath %>images/role_set.png" /></div>
  		       <div style="float:left;width:25px;cursor:pointer;"><img onclick="EditRole(<%=role.getRoleId() %>,this)" class="buttonBcImg" width="20" src="<%=basePath %>images/edit.jpg" /></div>
  		       <div style="float:left;width:25px;cursor:pointer;"><img onclick="DeleteRole(<%=role.getRoleId() %>,this)" class="buttonBcImg" width="20" src="<%=basePath %>images/delete.png" /></div>
  		       <div style="clear:both" ></div>
  		   </div>
  		   
  		  <%} %>
  		   <div id="ListDiv_cleanfloat" style="clear:both" ></div>
  		</div>
   </div>
   
  <div id="coverDiv" class="coverDiv"></div> <!-- 覆盖层，要放在所有弹出层之前 -->
  <!-- ********************************* RoleEditContainer Begin******************************************************* -->
  <div id="RoleEditContainer" class="addContenter" style="display:none;">
    <div id="addItem_title"  style="border-bottom:1px solid #666;margin-bottom:8px;" >
        <div id="EditRole_title" style="float:left; font-weight:bold;">Edit Role</div>
        <div style="float:right;">
            <a href="javascript:void(0);" id="EditRole_close" title="close">close</a>
        </div>
        <div style="clear:both" ></div>
    </div>
    <div id ="EditRole_container">
       <div class=itemDiv>
	     <span class="textSpan">&nbsp; Title:</span>
	     
	     <input class="inputText" id="E_title" name="E_title" value="" />
	   </div>
	   <div class="itemDiv">
	     <span class="textSpan">&nbsp; Identify:</span>
	     <input class="inputText" id="E_identify" name="E_identify"  readonly="readonly" value="" />
	   </div>
	   <div class="ListItem">
	   		<span class="textSpan">&nbsp; Comment:</span><br/>
	    	<textarea style="width:95%;" class="textArea"  id="E_comment" name="E_comment"></textarea>
	   </div>
    </div>
    <div class="submitContainer">
    	<input type="button" value="提交" onclick="submitEditRole()" />&nbsp;
    	<input type="hidden" id="E_roleId" name="E_roleId" value="" />
    	<input type="button" value="取消" onclick="hidenEditRole()"  />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	</div>
  </div>  
  <!-- ********************************* MimActionAddContainer End******************************************************* -->
   <div id="AssignOpToRoleDiv" class="saveNoticeContenter">
    <div id="addItem_title"  style="border-bottom:1px solid #666;margin-bottom:8px;">
        <div id="AssignOp_title" style="float:left; font-weight:bold;">为角色分配操作 </div>
        <div style="float:right;">
            <a href="javascript:void(0);" id="AssignOp_close" title="close">close</a>
        </div>
        <div style="clear:both" ></div>
    </div>
    <form id="SubmitToAuduitModuleForm" action="" method ="post" target ="_top" onsubmit="return false" >
    	<div  style=" padding:5px;border:1px solid #EAEAEA; margin:5px; color:red;font-weight:bold;"  >
    		<div id="OperationListDiv" style="margin:0px;overflow:auto;max-height:120px;border:1px;border-color:#666;color:#000;font-size:14px;">
    		   
    		</div>
		</div>
    	<div id="AuditOption" class="submitContainer">
    	    <input type="hidden" id="assign_roleId" name="assign_roleId" value="" />
    	   <input type="button" value="确定" onclick="submitAssignOpsToRole()" /> &nbsp;
    	   <input type="button" value="取消" onclick="hidenAssignOp()"/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   		</div>
    </form>
 </div>
  </body>
</html>
